import java.util.UUID;

/**
 * 电子票类
 * 用于表示用户购买的电影票
 */
public class Ticket {
    private String id;              // 电子票号（唯一）
    private Session session;        // 关联场次
    private int row;                // 座位行号
    private int seat;               // 座位号
    private double price;           // 实际支付金额
    private boolean isRefunded;     // 是否退票

    // 构造方法
    public Ticket(Session session, int row, int seat, double price) {
        this.id = UUID.randomUUID().toString().substring(0, 8);  // 简化UUID
        this.session = session;
        this.row = row;
        this.seat = seat;
        this.price = price;
        this.isRefunded = false;    // 初始未退票
    }

    // Getter和Setter
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public Session getSession() {
        return session;
    }

    public void setSession(Session session) {
        this.session = session;
    }

    public int getRow() {
        return row;
    }

    public void setRow(int row) {
        this.row = row;
    }

    public int getSeat() {
        return seat;
    }

    public void setSeat(int seat) {
        this.seat = seat;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public boolean isRefunded() {
        return isRefunded;
    }

    public void setRefunded(boolean isRefunded) {
        this.isRefunded = isRefunded;
    }
}
